<?php

class Application_Model_Post extends Application_Model_Object
{
    protected $_title;
    protected $_link;
    protected $_description;
    protected $_author;
    protected $_category;
    protected $_comments;
    protected $_enclosure;
    protected $_guid;
    protected $_pubdate;
    protected $_source;
    
    public function setOptions(array $options)
    {
        if (isset($options['title'])) {
            $this->setTitle($options['title']);
            unset($options['title']);
        }

        if (isset($options['link'])) {
            $this->setLink($options['link']);
            unset($options['link']);
        }

        if (isset($options['description'])) {
            $this->setDescription($options['description']);
            unset($options['description']);
        }

        if (isset($options['author'])) {
            $this->setAuthor($options['author']);
            unset($options['author']);
        }

        if (isset($options['category'])) {
            $this->setCategory($options['category']);
            unset($options['category']);
        }

        if (isset($options['comments'])) {
            $this->setComments($options['comments']);
            unset($options['comments']);
        }

        if (isset($options['enclosure'])) {
            $this->setEnclosure($options['enclosure']);
            unset($options['enclosure']);
        }

        if (isset($options['guid'])) {
            $this->setGuid($options['guid']);
            unset($options['guid']);
        }

        if (isset($options['pubdate'])) {
            $this->setPubdate($options['pubdate']);
            unset($options['pubdate']);
        }

        if (isset($options['source'])) {
            $this->setSource($options['source']);
            unset($options['source']);
        }

    }

    public function toArray()
    {
        $array = array();

        if (isset($this->_title)) {
            array['title'] = $this->_title;
        } else {
            array['title'] = '';
        }

        if (isset($this->_link)) {
            array['link'] = $this->_link;
        } else {
            array['link'] = '';
        }

        if (isset($this->_description)) {
            array['description'] = $this->_description;
        } else {
            array['description'] = '';
        }

        if (isset($this->_author)) {
            array['author'] = $this->_author;
        } else {
            array['author'] = '';
        }

        if (isset($this->_category)) {
            array['category'] = $this->_category;
        } else {
            array['category'] = '';
        }

        if (isset($this->_comments)) {
            array['comments'] = $this->_comments;
        } else {
            array['comments'] = '';
        }

        if (isset($this->_enclosure)) {
            array['enclosure'] = $this->_enclosure;
        } else {
            array['enclosure'] = '';
        }

        if (isset($this->_guid)) {
            array['guid'] = $this->_guid;
        } else {
            array['guid'] = '';
        }

        if (isset($this->_pubdate)) {
            array['pubdate'] = $this->_pubdate;
        } else {
            array['pubdate'] = '';
        }

        if (isset($this->_source)) {
            array['source'] = $this->_source;
        } else {
            array['source'] = '';
        }

        return $array;
    }

    public function setTitle($title)
    {
        $this->_title = $title;
    }
    public function getTitle()
    {
        return $this->_title;
    }

    public function setLink($link)
    {
        $this->_link = $link;
    }
    public function getLink()
    {
        return $this->_link;
    }

    public function setDescription($description)
    {
        $this->_description = $description;
    }
    public function getDescription()
    {
        return $this->_description;
    }

    public function setAuthor($author)
    {
        $this->_author = $author;
    }
    public function getAuthor()
    {
        return $this->_author;
    }

    public function setCategory($category)
    {
        $this->_category = $category;
    }
    public function getCategory()
    {
        return $this->_category;
    }

    public function setComments($comments)
    {
        $this->_comments = $comments;
    }
    public function getComments()
    {
        return $this->_comments;
    }

    public function setEnclosure($enclosure)
    {
        $this->_enclosure = $enclosure;
    }
    public function getEnclosure()
    {
        return $this->_enclosure;
    }

    public function setGuid($guid)
    {
        $this->_guid = $guid;
    }
    public function getGuid()
    {
        return $this->_guid;
    }

    public function setPubdate($pubdate)
    {
        $this->_pubdate = $pubdate;
    }
    public function getPubdate()
    {
        return $this->_pubdate;
    }

    public function setSource($source)
    {
        $this->_source = $source;
    }
    public function getSource()
    {
        return $this->_source;
    }


}

